public class BeerIssues {
    public static int sumBottles;
    public static int remainingBottles;
    public static int remainingCap;

    public static void main(String[] args) {
        getNumberBeers(20);
        System.out.println(sumBottles);
        System.out.println(remainingBottles);
        System.out.println(remainingCap);

    }

    public static void getNumberBeers(int money){
        int startBeers = money/2;
        sumBottles += startBeers;
        remainingBottles += startBeers;
        remainingCap += startBeers;

        int allMoney = (remainingBottles/2) * 2 + (remainingCap/4) * 2;
        remainingCap  =  remainingCap % 4;
        remainingBottles = remainingBottles % 2;
        if (allMoney >= 2){
            getNumberBeers(allMoney);
        }
    }
}
